<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../common/taglibs.jsp"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>${table.comment!}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${r'${ctxLayui}'}/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${r'${ctxLayui}'}/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${r'${ctxLayui}'}/layuiadmin/style/myStyle.css" media="all">
</head>
<#assign fields = table.fields />
<body>
<div class="layui-form layui-row" lay-filter="${table.entityPath}Form" id="${table.entityPath}Form" style="padding: 20px 10px 0 0;">
    <#list fields as field>
    <#assign comment=field.comment/>
    <#assign propertyName=field.propertyName/>
    <#assign propertyType=field.propertyType/>
    <div class="layui-col-xs12 layui-col-sm6 layui-col-md6" >
        <label class="layui-form-label">${comment}</label>
        <div class="layui-input-block">
            <#if propertyType=='Integer' || propertyType=='LocalDateTime'>
            <div class="layui-form-mid word_break ${propertyName}Str"></div>
            <#else>
            <div class="layui-form-mid word_break ${propertyName}"></div>
        </#if>
        </div>
    </div>
    </#list>
</div>

<script src="${r'${ctxLayui}'}/layuiadmin/layui/layui.js"></script>
<script >
    layui.config({
        base: '${r'${ctxLayui}'}/layuiadmin/'
    }).extend({
        index: 'lib/index'
    }).use(['index', 'form','dict','laytpl','util'], function(){
        var $ = layui.$ ,form = layui.form;
        var dict = layui.dict;
        var laytpl = layui.laytpl;
        var util = layui.util;
        var formData = window.parent.formData;
    <#list fields as field>
        <#assign comment=field.comment/>
            <#assign propertyName=field.propertyName/>
            <#assign propertyType=field.propertyType/>
            <#if propertyType=='Integer'>
        formData.${propertyName}Str = dict.showName("dict_${table.entityPath}_${propertyName}",formData.${propertyName});
    </#if>
        </#list>
    <#list fields as field>
        <#assign comment=field.comment/>
            <#assign propertyName=field.propertyName/>
            <#assign propertyType=field.propertyType/>
            <#if propertyType=='LocalDateTime'>
        formData.${propertyName}Str = formData.${propertyName}?util.toDateString(formData.${propertyName},'yyyy-MM-dd'):'';
    </#if>
        </#list>
        for(var key in formData){
            if(key && formData[key]){
                $("#${table.entityPath}Form ."+key).html(formData[key])
            }
        }
    })
</script>
</body>
</html>
